
Map 
---
static global variables
(Starting at address 54F7F8)


Address	Offset 	Description
-------	------ 	-----------
54F7F8 	0x0	
54F7FC 	0x4	int pixelWidthMask	[Wrap coordinates around map]
54F800 	0x8	int pixelWidth
54F804	0xC	int tileXMask		[wrap coordinates around map]
54F808	0x10	int tileWidth
54F80C 	0x14 	char lgTileWidth	[logTileWidth+1 if < 9]
54F810	0x18	int tileHeight		[2^lgTileHeight]
54F814	0x1C	Rect clipRect		[Bound on unit movement]
 54F814	 0x1C	 int x1	[(lgTileWidth >= 9) ? -1 : 0x20]
 54F818	 0x20	 int y1 [1]
 54F81C	 0x24	 int x2 [(lgTileWidth >= 9) ? 2^31-1 : mapTileWidth + 0x1F]
 54F820	 0x28	 int y2
54F824 	0x2C	int numTiles		[tileWidth * tileHeight]
54F828 	0x30	int numTileSets		[512]  [reserved space]
54F82C	0x34	char lgTileHeight	[rounded up]
54F830	0x38	int paddingOffsetTileX	[padding around map edges]
54F834 	0x3C 	int numUnits
54F838	0x40	int lastUsedUnitIndex
54F83C	0x44	int nextFreeUnitSlotIndex
54F840	0x48	int firstFreeUnitSlotIndex
54F844	0x4C	Unit*[]* freeUnitList
54F848	0x50	Unit[1025]* unitArray	[(sizeof(Unit) = 120) * 1025 = 123000]
54F84C	0x54	Unit* nextUnitList?	[ ** TODO ** ]
54F850	0x58	Unit* prevUnitList?	[ ** TODO ** ]
54F854	0x5C	char[] lightLevel


54FC58	0x460	WellString array pointer
54FC5C	0x464	int[]* tileData
54FC60	0x468	tileMappings object array pointer (numTileSets elements)
54FC64 	0x46C 	terrainTypeManager object pointer (holds terrainType objects - 0x108 byte objects)


Map Tile Format (32 bits)
-------------------------
Bit Offset 	length 	BitMask 	Description
---------- 	------ 	------- 	-----------
0x0		5 	0x0000001F 	Cell type (GetCellType)
0x5 		11 	0x0000FFE0 	Tile (GetTile)
0x10 		11 	0x07FF0000 	unitID of unit on this tile
0x1B 		1 	0x08000000 	
0x1C 		1 	0x10000000 	Lava possible (SetLavaPossible)
0x1D 		1 	0x20000000 	
0x1E 		1 	0x40000000 	(SetVirusUL)
0x1F 		1 	0x80000000 	
